package org.arroganz.kapa.enherics;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;

import org.arroganz.kapa.abstracts.AbstractItem;

public class ItemAssembly extends AbstractItem{

	private Hashtable<Integer, ItemSingle> htItemSingles;
	
	public ItemAssembly(){
		
		this.price = makePrice();
		this.timeProduction = makeTimeProduction();
		
	}
	
	/**
	 * creates the Price of the hole Assembly bye checks the Prices of the Single Items
	 * @return price
	 */
	private double makePrice(){
		double price = 0;
		
		ArrayList<Double> doubleList = new ArrayList<Double>();
		
		for(Enumeration<ItemSingle> e = htItemSingles.elements();e.hasMoreElements();){
			ItemSingle itemSingle = e.nextElement();
			doubleList.add(itemSingle.getPrice());
			// add a list and Comment the User that several Item have no set Price. If them so
		}
		
		if(doubleList.isEmpty()){
			return 0; // change somthing to know that this is empty
		}
		
		doubleList.trimToSize();
		
		Double[] doubleArray = new Double[doubleList.size()];
		
		for(int i = 0;i<doubleList.size();i++){
			price = price + doubleList.get(i);
		}
		
		return price;
	}
	
	/**
	 * creates the production Time of the hole Assembly bye checks the production Time of the Single Items
	 * @return price
	 */
	private int makeTimeProduction(){
		int pTime= 0;
		
		
		
		return pTime;
	}
	
	
}
